/*
 * p4749.cpp
 *
 *  Created on: 2013-10-25
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int a[100005];
vector<int> T[26];
int n, m, k;
bool ok(int t)
{
	int d[26];
	memset(d, 0, sizeof(d));
	for (int i = 1; i <= k; i++)
		for (int j = 0; j < T[i].size(); j++)
		{
			if (j == 0)
				d[i] = a[t + T[i][j]];
			else if (d[i] != a[t + T[i][j]])
				return false;
		}
	for (int i = 1; i < k; i++)
		for (int j = i + 1; j <= k; j++)
			if (d[i] && d[j] && d[i] > d[j])
				return false;
	return true;
}
int main()
{
	while (scanf("%d%d%d", &n, &m, &k) != EOF)
	{
		for (int i = 1; i <= n; i++)
			scanf("%d", &a[i]);
		for (i = 1; i <= k; i++)
			T[i].clear();
		for (int i = 0; i < m; i++)
		{
			int x;
			scanf("%d", &x);
			T[x].push_back(i);
		}
		int ans = 0;
		for (int t = 1; t <= n - m + 1; t++)
			if (ok(t))
			{
				t += m - 1;
				ans++;
			}
		printf("%d\n", ans);

	}
	return 0;
}
